package com.thenie.chat.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.thenie.chat.vo.UserVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *   用户类
 * </p>
 *
 * @author thenie
 * @since 2022-05-17
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("t_user")
public class User implements Serializable {

    private static final long serialVersionUID = 7301394406103697815L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 登陆名/ CHAT号
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 加盐
     */
    private String salt;

    /**
     * 性别 0/1
     */
    private Integer sex;

    /**
     * 照片地址
     */
    private String photo;

    /**
     * 昵称
     */
    private String realName;

    /**
     * 个性签名
     */
    private String status;

    /**
     * 地址
     */
    private String location;

    /**
     * 账号创建日期
     */
    private Date createDate;

    public User(UserVo userVo){
        this.id = userVo.getUserId();

        this.sex = userVo.getSex();
        this.photo = userVo.getPhoto();
        this.realName = userVo.getRealName();
        this.status =userVo.getStatus();
        this.location = userVo.getLocation();
    }

}
